package edu.sctu.zhangwang.month201506.day20150628.list_hash;

import java.io.*;

/**
 * Created by Administrator on 2015/6/28.
 */
public class Input_file {
    File file = new File("D://Json");
    File file1 = new File("D://Json/Json.txt");
    public void input(){
        file.mkdirs();
        if (file1.exists()) {
            try {
                FileOutputStream fileOutputStream = new FileOutputStream("D://Json/Json.txt");
                try {
                    OutputStreamWriter writer = new OutputStreamWriter(fileOutputStream,"utf-8");
                    try {
                        writer.append("这里应该是获取的数据。。。");
                        System.out.println("数据录入中。。");
                        writer.close();
                        fileOutputStream.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }else{
            try {
                file1.createNewFile();
                System.out.println("创建成功");
                input();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args) {
        Input_file input_file = new Input_file();
        input_file.input();
    }
}
